Skip to content

added 189 #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 17, 2021
Merged

added 189 #165

merged 5 commits into from
May 17, 2021

Conversation

ShambhaviSharma0110
Copy link
Contributor

@ShambhaviSharma0110 ShambhaviSharma0110 commented May 16, 2021

Pull Request Template

Description

Please include a summary of the problem and about the approach to solve the solution. Please also include relevant motivation and context.
List any dependencies that are required for this change.

We basically have to rotate an array in a cyclic manner and the rotation has to be for a subarray of k size of elements.
I have used the approach of reversing to solve the problem, we'll reverse the array thrice to get the solution, time complexity =O(n) and space is O(1)

Put check marks:

Have you made changes in README file ?

  • [ x] Added problem & solution under correct topic.
  • [ x] Specified Space & Time complexity.
  • [ x] Specified difficulty level, tag & Note(if any).

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

  • Test A
    nums = [1,2,3,4,5,6,7], k = 3
    Output: [5,6,7,1,2,3,4]
  • Test B
    nums = [-1,-100,3,99], k = 2
  • Output: [3,99,-1,-100]

Make sure all below guidelines are followed else PR will get Reject:

  • [x ] My code follows the style guidelines of this project
  • [x ] I have performed a self-review of my own code
  • I have commented my code so that it is easy to understand
  • [x ] I have made corresponding changes to the documentation
  • [x ] My changes generate no new warnings
  • [ x] Any dependent changes have been merged and published in downstream modules

@welcome
Copy link

welcome bot commented May 16, 2021

I can tell this is your first pull request! Thank you I'm so honored. 🎉🎉🎉 I'll take a look at it ASAP!

@GouravRusiya30
Copy link
Member

HI @ShambhaviSharma0110
Please check out the sample PR

@ShambhaviSharma0110
Copy link
Contributor Author

is it okay now?

@GouravRusiya30
Copy link
Member

Looks good to me !!!

@GouravRusiya30 GouravRusiya30 merged commit fd4c9aa into codedecks-in:master May 17, 2021
@welcome
Copy link

welcome bot commented May 17, 2021

Your code looks great! Congrats, I've gone ahead and merged your first pull request! Keep it up! alt text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants